package com.msgserver.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Cascade;



/**
 * Entity implementation class for Entity: EmployeeGroup
 *
 */
@Entity

public class EmployeeGroup extends VO implements Serializable {

	
	private static final long serialVersionUID = 1L;

	public EmployeeGroup() {
		super();
	}
   
	private Company company;
	private Set<Employee> employee = new HashSet<Employee>();
	
	@ManyToOne(optional = false)
	@JoinColumn(name = "companyId", referencedColumnName = "id", nullable = false)
	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}
	@ManyToMany
	@JoinTable(name = "Group_Employee", joinColumns = @JoinColumn(name = "groupId", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "employeesId", referencedColumnName = "id"))
	@Cascade({ org.hibernate.annotations.CascadeType.PERSIST,
			org.hibernate.annotations.CascadeType.MERGE })
	public Set<Employee> getEmployee() {
		return employee;
	}

	public void setEmployee(Set<Employee> employee) {
		this.employee = employee;
	}
	
	
	
}
